﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Mani.Patient.Business.Domain.Entity;
using NHibernate;
using NHibernate.Expression;

namespace Mani.Patient.Business.Dao {

    public interface IQuestionDao : IDao<Question> {

        IList<Question> GetQuestionsByType(QuestionType qt);
    }

    public class QuestionDao : DaoBase<Question>, IQuestionDao {

        public IList<Question> GetQuestionsByType(QuestionType qt) {
            ICriteria criteria = base.Session.CreateCriteria(typeof(Question));
            criteria.Add(Expression.Eq("QuestionType", qt));
            return criteria.List<Question>();
        }
    }
}
